// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   CategorySeries.java

package org.achartengine.model;

import java.io.Serializable;
import java.util.*;

// Referenced classes of package org.achartengine.model:
//			XYSeries

public class CategorySeries
	implements Serializable
{

	private String mTitle;
	private List mCategories;
	private List mValues;

	public CategorySeries(String s)
	{
		mCategories = new ArrayList();
		mValues = new ArrayList();
		mTitle = s;
	}

	public String getTitle()
	{
		return mTitle;
	}

	public synchronized void add(double d)
	{
		add((new StringBuilder()).append(mCategories.size()).append("").toString(), d);
	}

	public synchronized void add(String s, double d)
	{
		mCategories.add(s);
		mValues.add(Double.valueOf(d));
	}

	public synchronized void set(int i, String s, double d)
	{
		mCategories.set(i, s);
		mValues.set(i, Double.valueOf(d));
	}

	public synchronized void remove(int i)
	{
		mCategories.remove(i);
		mValues.remove(i);
	}

	public synchronized void clear()
	{
		mCategories.clear();
		mValues.clear();
	}

	public synchronized double getValue(int i)
	{
		return ((Double)mValues.get(i)).doubleValue();
	}

	public synchronized String getCategory(int i)
	{
		return (String)mCategories.get(i);
	}

	public synchronized int getItemCount()
	{
		return mCategories.size();
	}

	public XYSeries toXYSeries()
	{
		XYSeries xyseries = new XYSeries(mTitle);
		int i = 0;
		double d;
		for (Iterator iterator = mValues.iterator(); iterator.hasNext(); xyseries.add(++i, d))
			d = ((Double)iterator.next()).doubleValue();

		return xyseries;
	}
}
